package com.zx.wangyixinwen.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.zx.wangyixinwen.R;

import java.util.ArrayList;

/**
 * Created by dllo on 16/1/6.
 */
public class NewsAdapter extends FragmentPagerAdapter {
    private Context context;
    private ArrayList<Fragment> datas;


    String[] titles = {"头条", "段子", "美女"};

    public NewsAdapter(FragmentManager fm, Context context, ArrayList<Fragment> datas) {
        super(fm);
        this.context = context;
        this.datas = datas;
    }

    @Override
    public Fragment getItem(int position) {
        return datas.get(position);
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles [position];
    }

//    public View getTabView(int position) {
//        View view = LayoutInflater.from(context).inflate(R.layout.tabs, null);
//        TextView textView = (TextView) view.findViewById(R.id.tv_tabs);
//        textView.setText(titles [position]);
//        return view;
//    }
}
